package com.tender.impl;

import com.tender.ShiroUserBizService;
import com.tender.domain.ShiroUser;
import com.tender.dto.ShiroUserDTO;
import com.tender.enums.EnableFlagEnum;
import com.tender.enums.SexEnum;
import com.tender.service.ShiroUserService;
import com.tender.utils.SnowflakeIdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShiroUserBizServiceImpl implements ShiroUserBizService {

    @Autowired
    private ShiroUserService shiroUserService;

    @Override
    public int registerUser(ShiroUserDTO shiroUserDTO) {

        // TODO
        ShiroUser param = new ShiroUser();
        param.setRowId(SnowflakeIdGenerator.instance().nextId());
        param.setLoginName("tender");
        param.setRealName("苏东");
        param.setNickName("竹山居士");
        param.setPassWord("123");
        param.setSalt(null);
        param.setSex(SexEnum.MALE.getCode());
        // 邮政编码
        param.setZipcode(null);
        param.setAddress(null);
        param.setTel("15150565555");
        param.setMobil(null);
        param.setEmail(null);
        param.setDuties(null);
        param.setSortNo(1);
        param.setEnableFlag(EnableFlagEnum.YES.getCode());

        return shiroUserService.insertSelective(param);
    }

}
